package com.ymatou.iapi.godmch.service;

import java.util.List;

import org.json.JSONException;

import net.sf.json.JSONObject;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.ymatou.iapi.godmch.parameter.BizItem;
import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;
/**
*批量获取业务配置参数Call
*FreeMaker Template自动生成代码
*/
public class batchGetBizConfigCall extends YmatouBaseCall{
	private static String opurl ="api/config/batchGetBizConfig";
	
	public batchGetBizConfigCall() {
		super(EnvSetup.getSystemUrl("godmch_iapi"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	public String getStatusCode1()
	{
	  return getString("status");
	}
	
	 public String getMessage()
	{
	 return getString("msg");
	}
	 
	 
	 public List<BizItem> getBatchList() throws JSONException
	 {
		 Gson gson = new Gson();
		 String json=new org.json.JSONObject(getString("result")).get("batchList").toString();
		 List<BizItem> items = gson.fromJson(json, new TypeToken<List<BizItem>>() { }.getType());//对于不是类的情况，用这个参数给出
		 return items;
	 }
}